import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import {ElementPlusResolver} from 'unplugin-vue-components/resolvers'
import os from 'os'

const appName = os.type() === 'Darwin' ? 'Google Chrome' : 'chrome';

// https://vitejs.dev/config/
export default defineConfig({
	plugins: [
		vue(),
		AutoImport({
			resolvers: [ElementPlusResolver()],
		}),
		Components({
			resolvers: [ElementPlusResolver()],
		}),
	],
	resolve: {
		extensions: ['.js', '.vue'],
	},
	server: {
		port: 4200,
		//代理--------------
		// proxy:{
		// 	'/api':{
		// 		target:'http://localhost:4300',// 开发时换成实际代理目标
		// 		changeOrigin:true,
		// 		rewrite:path => path.replace(/^\/api/,'')
		// 	}
		// },
		//---------------
		open: {
			app: {
				name: appName
			}
		}
	}
})
